package com.example.demo.dto;

import lombok.Data;

@Data
public class Response<T> {

    Integer code;
    String msg;
    T data;

    public Response() {
    }

    public Response(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Response SUCCESS(T data) {
        return new Response(200, "SUCESS", data);
    }

    public Response FAIL() {
        return new Response(500, "FAIL", data);
    }

    public Response FAIL(T data) {
        return new Response(500, "FAIL", data);
    }


    public Response FAIL(String msg) {
        return new Response(500, msg, data);
    }

    public Response FAIL(String msg, T data) {
        return new Response(500, msg, data);
    }
}
